<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<div id="app">
			{{allData}}
			<button type="button" @click="setAttr">点我设置计算属性</button>
		</div>
		<script src="../node_modules/vue/dist/vue.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			let vm = new Vue({
				el: '#app',
				data(){
					return {
						values: '10',
						numbers: 11,
						dataList: [{name: 'zqf'}, {name: '123'}],
						user: 'zhangqianfeng'
					}
				},
				computed: {
					//计算属性默认只有getter
					allData(){
						return this.values + this.numbers
					},
					getUser: {
						get(){
							return this.user
						},
						set(value){
							this.user = value
						},
					}
				},
				methods: {
					setAttr(){
						this.getUser = 'zqf123'
						console.log(this.user)
					}
				},
			})
		</script>
	</body>
</html>
